#pragma once
#include "stdafx.h"
#include "optplugin.h"
#include "OptimusPluginShim.h"

class PluginShimImpl :
	public OptimusMiniPlugin
{
private:
	IOptimusPlugin *pManagedImpl;

public:
	PluginShimImpl(int function, WCHAR* managedPluginProgID);
	~PluginShimImpl(void);

	virtual BOOL __stdcall Paint(HDC hdc);
	
	// called on keydown from device thread. should return fast.
	// button: pressed button, from 1 to MAX_BUTTON.
	virtual void __stdcall OnKeyDown();
	
	// to collect INFO_* values from plugin 
	virtual LPARAM __stdcall GetInfo(int index);

	// allows to get properties from plugin instance
	// index: from PLUGIN_PROPERTIES and PLUGIN_SHARED_PROPERTIES until false is return.
	// should return value and name (no longer then MAX_PROPERTY_LENGTH bytes)
	virtual BOOL __stdcall GetProperty(int index, char *name, char *value);

	// allows to set plugin instance properties
	// called for every name got with GetProperty with actial value from registry
	virtual BOOL __stdcall SetProperty(const char *name, const char *value);

	// shows plugin properties dialog. 
	// should return true if properties has been changed.
	virtual BOOL __stdcall ShowProperties(HWND hwnd);

	// plugin life cicle is OnEvent(ACTIVATE) -> Paint(),Paint().. -> OnEvent(DEACTIVATE)
	// ACTIVATE/DEACTIVATE can be used to allocate resources requied for painting
	// should return TRUE. should return fast.
	virtual BOOL __stdcall OnEvent(int event);
};
